﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.Platform.Contract;
using MaxLeaf.Platform.BLLImplementation;
using CommonsLib.Utility;
using MaxLeaf.Platform.DataContract;
using CommonsLib.Settings;
using MaxLeaf.Platform.Functions;

namespace MaxLeaf.Platform.BLLProxy
{

    /// <summary>
    /// 采购需求单 相关操作
    /// </summary>
    public class poReqProcessorProxy : BaseBLLProxy, IPoReqProcess
    {

        IPoReqProcess _bll;
        private  IPoReqProcess BLL
        {
            get
            {                
                return _bll;
            }
        }
        public poReqProcessorProxy():base()
        {
            switch ( Access_Mode )
            {

                case MaxLeaf.Platform.Commons.Const.ACCESS_Direct:
                    {
                        _bll = new poReqProcessor();
                        break;
                    }

                case MaxLeaf.Platform.Commons.Const.ACCESS_IIS:
                    {
                        _bll = new poReqProcessorWCFClient(this.WCF_Configs);
                        break;
                    }


                default:
                    {
                        throw new MaxLeaf.Platform.Commons.MaxLeafException(MaxLeaf.Platform.Commons.Const.EXCEPTION_MESSAGE_INVALID_ACCESSMODE_CONFIG);

                    }
            }
        }
       

        /// <summary>
        /// 生成订单
        /// </summary>
        /// <param name="intEnterUserId">采购人</param>
        /// <param name="intHdrID">采购需求单 hdr key</param>
        /// <param name="lstDtlKeys">采购需求单dtl 集合 -- 如果为空,表示整张需求单</param>
        /// <returns>订单</returns>
        public poOrderHdrDataModel Post(int intEnterUserId, int intHdrID, List<int> lstDtlKeys)
        {
            return BLL.Post(  intEnterUserId,intHdrID, lstDtlKeys);
        }

        /// <summary>
        /// 批量post
        /// </summary>
        /// <param name="intEnterUserId"></param>
        /// <param name="lstHdrKeys"></param>
        /// <returns></returns>
        public poOrderHdrDataModel PostBatch(int intEnterUserId, List<int> lstHdrKeys)
        {
            return BLL.PostBatch(intEnterUserId, lstHdrKeys);
        }
    }
}
